package com.wjx.utils;


import com.wjx.dtos.UserDTO;

public class ThreadLocalUtil {

    private final static ThreadLocal<UserDTO> USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户

     */
    public static void  setUser(UserDTO user){
        USER_THREAD_LOCAL.set(user);
    }

    /**
     * 获取用户
     */
    public static UserDTO getUser(){
        return USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear(){
        USER_THREAD_LOCAL.remove();
    }
}